#include "AdminMainWindow.h"
#include "ui_AdminMainWindow.h"

AdminMainWindow::AdminMainWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AdminMainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("管理员菜单");  //设置标题
    /**
      * @leiteorz
      * 显示右下角的欢迎label
      */
    //当前用户表current_user
    CurrentUser current_user;
    User u = current_user.queryCurrentUser();
    QString str = u.name;
    ui->name_label->setText(str);
}

AdminMainWindow::~AdminMainWindow()
{
    delete ui;
}

void AdminMainWindow::replyShowAdminMainWindow(){
    this->show();
    /**
      * @leiteorz
      * 显示右下角的欢迎label
      */
    //当前用户表current_user
    CurrentUser current_user;
    User u = current_user.queryCurrentUser();
    QString str = u.name;
    ui->name_label->setText(str);
}

//添加食物按钮
void AdminMainWindow::on_add_food_btn_clicked(){
    emit showAdminAddNewFoodWindow();
}

//退出登陆按钮
void AdminMainWindow::on_log_out_btn_clicked(){
    emit showMainWindow();
    this->hide();
}

//添加新的管理员账户按钮
void AdminMainWindow::on_add_admin_btn_clicked(){
    emit showAdminAddAdminWindow();
}

//下架食物按钮
void AdminMainWindow::on_remove_food_btn_clicked(){
    emit showAdminFoodWindow();
}

//查看订单按钮
void AdminMainWindow::on_query_order_btn_clicked()
{
    emit showAdminFoodOrderListWindow();
}
